import request from "@/utils/request.ts";
import {
   codeResponseData,
   loginData,
   loginResponseData,
   userInfoResponseData,
   documentTypeResponseData,
   visitorInfoResponseData,
   visitorInfo
} from "@/api/user/type.ts";

enum API{
   //  验证码接口地址
   code='/sms/send/',
   // 登录的接口地址
   login='/user/login',
   // 获取用户信息的接口地址
   userinfo='/user/auth/getUserInfo',
   // 证件类型接口地址
   document_type='/cmn/dict/findByDictCode/CertificatesType',
   // 实名认证的接口地址
   authentication='/user/auth/userAuah',
   // 地址的接口地址
   location='/cmn/dict/findByParentId/',
   // 就诊人信息的接口地址
   visitor_info='/user/patient/auth/get/',
   // 新增就诊人的接口
   add_visitor='/user/patient/auth/save',
   // 删除就诊人的接口
   delete_visitor='/user/patient/auth/remove/',
   // 修改就诊人的接口
   update_visitor='/user/patient/auth/update'

}

// 获取验证码请求
export const reqCode=(phone:string)=>request.get<any,codeResponseData>(API.code+`${phone}`)

//登录请求
export const reqLogin=(data:loginData)=>request.post<any,loginResponseData>(API.login,data)

//获取用户信息的请求
export const reqUserInfo=()=>request.get<any,userInfoResponseData>(API.userinfo)

//获取证件类型的请求
export const reqDocumentType=()=>request.get<any,documentTypeResponseData>(API.document_type)

//实名认证的请求
export const reqauthentication=(data:any)=>request.post(API.authentication,data)

//地址的请求
export const reqLocation=(parentId:number)=>request.get(API.location+`${parentId}`)

// 就诊人详细信息的请求
export const reqVisitorInfo=(id:number)=>request.get<any,visitorInfoResponseData>(API.visitor_info+`${id}`)

//新增就诊人的请求
export const reqAddVisitor=(data:visitorInfo)=>request.post<any,visitorInfoResponseData>(API.add_visitor,data)

//删除就诊人的请求
export const reqDeleteVisitor=(id:string)=>request.delete<any,any>(API.delete_visitor+`${id}`)

//修改就诊人的请求
export const reqUpdateVisitor=(data)=>request.put(API.update_visitor,data)